<?php

namespace App\Repositories\Criteria\Article;

use App\Repositories\Contracts\CriteriaInterface;
use App\Repositories\Contracts\RepositoryInterface as Repository;
use App\Repositories\Contracts\RepositoryInterface;
use App\Repositories\Criteria\Criteria;

class Authorid extends Criteria
{
    /**
     * 用户id
     *
     * @var
     */
    protected $authorId;

    /**
     * Authorid constructor.
     * @param $authorId
     */
    public function __construct($authorId)
    {
        $this->authorId = $authorId;
    }

    /**
     * @param $model
     * @param RepositoryInterface $repository
     * @return mixed
     */
    public function apply($model, Repository $repository)
    {
        $query = $model->where('author_id', '=', $this->authorId);
        return $query;
    }
}